package com.dailyblue.java.project.bookstore.author.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dailyblue.java.project.bookstore.author.bean.Author;
import com.dailyblue.java.project.bookstore.author.mapper.AuthorMapper;
import com.dailyblue.java.project.bookstore.author.service.AuthorService;
import com.dailyblue.java.project.bookstore.author.util.JsonResult;
import com.dailyblue.java.project.bookstore.author.util.ResultTool;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class AuthorServiceImpl extends ServiceImpl<AuthorMapper, Author> implements AuthorService {
    @Cacheable(cacheNames = "findAuthorById", key = "#id")
    public JsonResult findAuthorById(int id) {
        return ResultTool.success(getById(id));
    }
}
